//
// Copyright (c) 2011, Peter Lane
// Licensed under the Academic Free License version 3.0

package fan.swtChartWrapper;

import fan.fwt.*;
import fan.gfx.Color;
import fan.gfx.Font;
import fan.sys.*;
import org.eclipse.swtchart.ISeriesLabel;

public class SeriesLabelPeer {
  private ISeriesLabel _label = null;

  public static SeriesLabelPeer make (fan.swtChartWrapper.SeriesLabel self) throws Exception {
    return new SeriesLabelPeer ();
  }

  public void setILabel (ISeriesLabel label) {
    _label = label;
    _label.setVisible (_visible);
    _label.setFont (Fwt.get().font(_font));
    _label.setForeground (Fwt.get().color(_foreground));
    if (_format != "") _label.setFormat (_format);
  }

  private String _format = "";
  public String format (fan.swtChartWrapper.SeriesLabel self) { return _format; }
  public void format (fan.swtChartWrapper.SeriesLabel self, String v) { 
    _format = v; 
    if (_label != null) _label.setFormat (_format);
  }

  private Font _font = Desktop.sysFont().toSize (9);
  public Font font (fan.swtChartWrapper.SeriesLabel self) { return _font; }
  public void font (fan.swtChartWrapper.SeriesLabel self, Font f) {
    _font = f;
    if (_label != null) _label.setFont (Fwt.get().font(_font));
  }

  private Color _foreground = Color.black;
  public Color foreground (fan.swtChartWrapper.SeriesLabel self) { return _foreground; }
  public void foreground (fan.swtChartWrapper.SeriesLabel self, Color v) {
    _foreground = v;
    if (_label != null) _label.setForeground (Fwt.get().color(_foreground));
  }

  private boolean _visible = false;
  public boolean visible (fan.swtChartWrapper.SeriesLabel self) { return _visible; }
  public void visible (fan.swtChartWrapper.SeriesLabel self, boolean v) {
    _visible = v;
    if (_label != null) _label.setVisible (_visible);
  }

}

